import axios from 'axios'

const action = {
  getBannerListAction (dispatch) {
    // axios 自动转换为json数据
    axios.get('http://121.89.205.189/api/banner/list')
      .then(res => {
        dispatch({
          type: 'CHANGE_HOME_BANNER_LIST',
          payload: res.data.data
        })
      })
  },
  getProListAction (params) {
    return (dispatch) => {
      axios.get('http://121.89.205.189/api/pro/list', { params: params})
      .then(res => {
        dispatch({
          type: 'CHANGE_HOME_PRO_LIST',
          payload: res.data.data
        })
      })
    }
  }
}

export default action